Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

solution - declare notesdocument locally

I found the problem. I was trying to write the function so that it could work in two different ways - with the document I needed passed directly as an argument OR if "nothing" was passed instead then be able to go and find it.

Apparently when you have a NotesDocument defined as an argument to your function, you cannot reassign that object variable. When I declared the target NotesDocument as a local object variable, then both GetDocumentByUNID (NotesDatabase) and GetDocumentByKey (NotesView) worked just as expected.

Looks like I need to brush up on the rules for byref vs byval parameters with respect to notes objects.

Working code:

Function ImpUpdateLetter(letterUNID As String,allowSaveLetter As Boolean) As String
Dim s As New NotesSession
Dim letterDoc As NotesDocument
Dim researchDoc As NotesDocument
Dim researchView As NotesView
Dim researchId As String
Dim sql As String
Dim saveLetter As Boolean
Dim resUnid As String

...

If Len(letterUNID) = 0 Then
Set letterDoc = ws.Currentdocument.Document
Else
Set letterDoc = s.Currentdatabase.Getdocumentbyunid(letterUNID)
End If

resUnid = letterDoc.ResearchRequestID(0)
Set researchView = s.Currentdatabase.Getview("(LU Research By ResReqID)")
Set researchDoc = researchView.GetDocumentByKey(resUnid)
If researchDoc Is Nothing Then
MsgBox "Unable to find research request for this letter (" & resUnid & "). Please submit an IT ticket to report this problem or notify your manager. Thank you.",0,"Programming error."
End
End If

...


Feedback response number WEBB959N9J created by ~Mark Nonjipysterings on 02/25/2013

GetDocumentByUNID - no error, no do... (~Mark Nonjipyst... 21.Feb.13)
. . On Error Resume Next (~Fred Xanjumima... 21.Feb.13)
. . . . good point, but... (~Mark Nonjipyst... 22.Feb.13)
. . . . . . could be finding a deletion stub...... (~Justin Chugero... 22.Feb.13)
. . NotesView GetDocumentByKey doesn't ... (~Mark Nonjipyst... 22.Feb.13)
. . solution - declare notesdocument lo... (~Mark Nonjipyst... 25.Feb.13)
. . . . Not quite as you are thinking, but ... (~Fred Asatumibu... 25.Feb.13)
. . . . . . Well, shucks (~Mark Nonjipyst... 25.Feb.13)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS